package com.zhumengquan.wozhi.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

@Controller
public class SessionController {
    @RequestMapping("/loginuser")
    @ResponseBody
    public String Main(HttpServletRequest request){
        System.out.println("查看当前用户啦");
        HttpSession session = request.getSession();
        String loginuser = (String) session.getAttribute("name");
        System.out.println(loginuser);
        return loginuser;
    }

}
